package com.tengju.user.domain.model.survey;

import java.util.List;

public class SurveyFactory {

    public static SurveyQuestionConfig createQuestionConfig(String itemCode, String itemTitle, Integer itemOrder, Integer itemType, Integer itemRequired, String itemParams,Integer msgType) {
        SurveyQuestionRequireEnum surveyQuestionRequireEnum = SurveyQuestionRequireEnum.parseByCode(itemRequired);
        SurveyQuestionTypeEnum surveyQuestionTypeEnum = SurveyQuestionTypeEnum.parseByCode(itemType);
        return new SurveyQuestionConfig(
                itemCode,
                itemTitle,
                itemOrder,
                surveyQuestionTypeEnum,
                surveyQuestionRequireEnum,
                itemParams,
                MsgType.fromVal(msgType)
        );
    }

    public static SurveyConfig createSurveyConfig(SurveyMeta surveyMeta, List<SurveyQuestionConfig> surveyQuestionConfigList) {
        SurveyConfig surveyConfig = new SurveyConfig(surveyMeta);
        surveyConfig.addQuestionConfigList(surveyQuestionConfigList);
        return surveyConfig;
    }
}
